import { Base } from '../utils/base.js';

class Goods extends Base {
    constructor() {
        super();
    }
	
	//获取分类
	category(data,callback){
		var params = {
		    url: 'goods/category',
		    type: 'get',
		    loading: true,
			data:data
		};
		this.apiRequest(params, callback);
	}
	
	//获取列表
	getList(data,callback){
		var params = {
		    url: 'goods/getList',
		    type: 'get',
		    loading: true,
			data:data
		};
		this.apiRequest(params, callback);
	}
	//商品删除
	goodsDel(data,callback){
		var params = {
		    url: 'goods/goodsDel',
		    type: 'post',
		    loading: true,
			data:data
		};
		this.apiRequest(params, callback);
	}
	
	//上下架
	goodsStatus(data,callback){
		var params = {
		    url: 'goods/goodsStatus',
		    type: 'post',
		    loading: true,
			data:data
		};
		this.apiRequest(params, callback);
	}
	uploadGoodsImage(data,callback){
		this.upload(data,callback);
	}
	
	//保存商品
	goodsSave(data,callback){
		var params = {
		    url: 'goods/goodsSave',
		    type: 'post',
		    loading: true,
			data:data
		};
		this.apiRequest(params, callback);
	}
	
	//获取详情
	goodsDetail(data,callback){
		var params = {
		    url: 'goods/goodsDetail',
		    type: 'get',
		    loading: true,
			data:data
		};
		this.apiRequest(params, callback);
	}
	
	//获取商家商品
	storeGoods(data,callback){
		var params = {
		    url: 'goods/GoodsList',
		    type: 'get',
		    loading: true,
			data:data
		};
		this.apiRequest(params, callback);
	}
	//添加订单
	goods_order_add(data,callback){
		var params = {
		    url: 'goods/createOrder',
		    type: 'post',
		    loading: false,
			data:data
		};
		this.apiRequest(params, callback);
	}
	//外卖订单列表
	goods_order_list(data,callback){
		var params = {
		    url: 'goods/OrderList',
		    type: 'get',
		    loading: true,
			data:data
		};
		this.apiRequest(params, callback);
	}
	//取消外卖订单
	goods_cancel_order(data,callback){
		var params = {
		    url: 'goods/CancelOrder',
		    type: 'get',
		    loading: true,
			data:data
		};
		this.apiRequest(params, callback);
	}
	//重新支付
	goods_pay_again(data,callback){
		var params = {
		    url: 'goods/PayAgain',
		    type: 'get',
		    loading: true,
			data:data
		};
		this.apiRequest(params, callback);
	}
}
export { Goods };